Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

content: Handle link previews #1049

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rajveermalviya
Copy link
Collaborator

@rajveermalviya rajveermalviya commented Nov 6, 2024

Fixes: #1016

Screenshots
Web Flutter
Screenshot 2024-12-12 at 23 29 22 Screenshot 2024-12-12 at 23 32 44
Screenshot 2024-12-12 at 23 29 29 Screenshot 2024-12-12 at 23 32 32
Web (Small) Flutter (Small)
Screenshot 2024-12-12 at 23 29 56 Screenshot 2024-12-12 at 23 33 08
Screenshot 2024-12-12 at 23 29 50 Screenshot 2024-12-12 at 23 33 16

@rajveermalviya rajveermalviya force-pushed the pr-content-link-previews branch from abdec10 to 8fba3fe Compare November 18, 2024 21:57
@rajveermalviya rajveermalviya marked this pull request as ready for review November 18, 2024 23:14
@rajveermalviya rajveermalviya added the maintainer review PR ready for review by Zulip maintainers label Nov 18, 2024
@chrisbobbe chrisbobbe self-requested a review December 10, 2024 20:33
@chrisbobbe chrisbobbe self-assigned this Dec 10, 2024
Copy link
Collaborator

@chrisbobbe chrisbobbe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Looks like this needs a rebase, so I'll do a more thorough review after that. But here are some comments from a quick skim (in particular I haven't read the parsing code or checked the UI code against web).

padding: const EdgeInsets.symmetric(horizontal: 5),
child: InsetShadowBox(
bottom: 8,
color: messageListTheme.streamMessageBgDefault,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it'll be wrong for DMs, and (in future) for messages where we highlight the background because of @-mentions in the message (#647).

child: Text(node.title!,
style: TextStyle(
fontSize: 1.2 * kBaseFontSize,
color: const HSLColor.fromAHSL(1, 200, 1, 0.4).toColor()))),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see a hard-coded color; does it follow web? It needs either a variable in ContentTheme or this comment:

// Web has the same color in light and dark mode.

(Same for any other hard-coded colors.)

Please also post screenshots in light mode; I see screenshots for dark mode already.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the screenshots.

if (isSmallWidth) {
return Container(
decoration: const BoxDecoration(border:
Border(left: BorderSide(color: Color(0xFFEDEDED), width: 3))),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment about hard-coded colors; also, I think we more often use lowercase (so 0xffededed instead of 0xFFEDEDED); here and below.

final messageListTheme = MessageListTheme.of(context);
final isSmallWidth = MediaQuery.sizeOf(context).width <= 576;

final dataContainer = Container(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is dataContainer the best name? I see the Container widget being used…what's the "data" and how does that widget "contain" it?

How about building this method's return value with help from a mutable Widget result variable? So here:

Widget result = Container(/* etc. */);

then below,

result = isSmallWidth
  ? Column(/* etc. */, children: [/* etc. */, result])
  : Row(/* etc. */, children: [/* etc. */, result]);

then result = Container(decoration: /* etc. */, child: result);

and finally return result;.

@rajveermalviya rajveermalviya force-pushed the pr-content-link-previews branch 2 times, most recently from 5b7b364 to 533fa33 Compare December 11, 2024 20:28
@rajveermalviya rajveermalviya force-pushed the pr-content-link-previews branch from 533fa33 to aeabbe6 Compare December 12, 2024 17:45
@rajveermalviya
Copy link
Collaborator Author

Thanks for the initial comments @chrisbobbe! Pushed a new revision, PTAL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintainer review PR ready for review by Zulip maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handle message_embed website previews
2 participants